package com.xauto.pioneer.appuser.model;

import org.json.JSONObject;

/**
 * 会员信息实体
 * Created by Lemon on 22/04/2017.
 */
public class Member extends BaseModel<Member> {

    /** 会员ID*/
    public String member_id;
    /** 会员名称*/
    public String member_name;
    /** 手机号码*/
    public String mobile;
    /** 手机号码格式化*/
    public String mobile_format;

    /** 头像图片*/
    public Image icon_image;
    /** 身份证图片*/
    public Image id_number_image;
    /** 手持身份证图片*/
    public Image id_number_with_people_image;
    /** 驾照图片*/
    public Image driving_license_image;

    /** 会员等级信息*/
    public MemberLevel member_level_info;
    /** 会员账户信息*/
    public MemberAccount member_account_info;
    /** 会员认证信息*/
    public MemberAuth member_auth_info;
    /** 会员订单信息*/
    public MemberOrder member_order_info;
    /** 会员优惠券信息*/
    public MemberCoupon member_voucher_info;
    /** 会员消息信息*/
    public MemberMessage member_message_info;
    /** 会员消息信息*/
    public MemberDeposit member_deposit_info;
    /** 会员发票状态信息*/
    public MemberReceiptInfo member_receipt_info;

    @Override
    public Member parse(JSONObject jsonObject) {
        if(jsonObject != null) {
            member_id = jsonObject.optString("member_id");
            member_name = jsonObject.optString("member_name");
            mobile = jsonObject.optString("mobile");
            mobile_format = jsonObject.optString("mobile_format");
            icon_image = new Image().parse(jsonObject.optJSONObject("icon_image"));
            id_number_image = new Image().parse(jsonObject.optJSONObject("id_number_image"));
            id_number_with_people_image = new Image().parse(jsonObject.optJSONObject("id_number_with_people_image"));
            driving_license_image = new Image().parse(jsonObject.optJSONObject("driving_license_image"));
            member_level_info = new MemberLevel().parse(jsonObject.optJSONObject("member_level_info"));
            member_account_info = new MemberAccount().parse(jsonObject.optJSONObject("member_account_info"));
            member_auth_info = new MemberAuth().parse(jsonObject.optJSONObject("member_auth_info"));
            member_order_info = new MemberOrder().parse(jsonObject.optJSONObject("member_order_info"));
            member_voucher_info = new MemberCoupon().parse(jsonObject.optJSONObject("member_voucher_info"));
            member_message_info = new MemberMessage().parse(jsonObject.optJSONObject("member_message_info"));
            member_deposit_info = new MemberDeposit().parse(jsonObject.optJSONObject("member_deposit_info"));
            member_receipt_info = new MemberReceiptInfo().parse(jsonObject.optJSONObject("member_receipt_info"));
            return this;
        }
        return null;
    }
}
